#import <Foundation/Foundation.h>
#import "JokeManager.h"
#import "JokeColumnCell.h"
#import "JokeModel.h"
#import "EGORefreshTableHeaderView.h"
#import "EGORefreshTableFooterView.h"
#import "EasyTableView.h"
#import "BaseUIViewController.h"

@protocol JokeColumnViewDelegate;
@protocol JCVSortDelegate;
@class JCVSort;

@interface JokeColumnView : UIView <EasyTableViewDelegate,EGORefreshTableHeaderDelegate,EGORefreshTableFooterDelegate> {
    IBOutlet UIButton           *backBtn;
    IBOutlet UIButton           *newBtn;
    IBOutlet UIImageView        *indicator;
    
    IBOutlet UIButton           *leftBtn;
    IBOutlet UIButton           *rightBtn;
    
    IBOutlet UILabel            *tipText;
    IBOutlet UIView             *tipTextContainer;
    NSTimer                     *tipTimer;
    
    IBOutlet UILabel            *indexLabel;
    IBOutlet UIView             *topBar;
    IBOutlet UIView             *bottomBar;
    IBOutlet UIButton           *allBtn;
    IBOutlet UIButton           *hotBtn;
    IBOutlet UIButton           *shitBtn;
    IBOutlet UIImageView        *allLine;
    IBOutlet UIImageView        *hotLine;
    IBOutlet UIImageView        *shitLine;
    IBOutlet UIView             *mainTableContainer;
    EasyTableView               *mainTable;
    EGORefreshTableHeaderView   *egoHeader;
    EGORefreshTableFooterView   *egoFooter;
    
    NSMutableDictionary         *sortMap;
}

@property (assign, nonatomic) BaseUIViewController<JokeColumnViewDelegate>  *owner;
@property (assign, nonatomic) JCVSort                                       *sortPlaying;
@property (assign, nonatomic) JCVSort                                       *sortDislaying;

- (void)start:(BaseUIViewController<JokeColumnViewDelegate> *)pOwner :(JokeManager *)pJokeManagerAll :(JokeManager *)pJokeManagerHot :(JokeManager *)pJokeManagerShit;
- (void)reload:(JokeManager *)pJokeManager :(NSIndexPath *)pJokeIndexPath;
- (void)doneNew:(JokeManager *)pJokeManager :(int)newCount;
- (void)doneNext:(JokeManager *)pJokeManager :(int)nextCount;
- (void)doneNewAndNext:(JokeManager *)pJokeManager :(int)newCount :(int)nextCount;
//- (void)gettingNew:(JokeManager *)pJokeManager;
//- (void)gettingNext:(JokeManager *)pJokeManager;
- (void)zoomIn;
- (void)zoomOut;
- (void)setSortDisplay:(UIButton*)sender;
- (IBAction)back:(id)sender;
- (IBAction)refreshNewAndNext:(id)sender;
- (IBAction)refreshNew:(id)sender;
- (IBAction)refreshNext:(id)sender;
- (IBAction)leftORright:(id)sender;
- (IBAction)viewLeft:(id)sender;
- (IBAction)viewRight:(id)sender;
- (void) showLoadingTip;
- (void) showAutoHideTip:(NSString *)tipStr :(int)newCount :(int)nextCount;

@end

@protocol JokeColumnViewDelegate<NSObject>
@optional
- (void)JCVselect:(JokeManager *)pJokeManager :(NSIndexPath *)pJokeIndexPath;
- (void)JCVgetNewAndNext;
- (void)JCVgetNew;
- (void)JCVgetNext;
@end

#pragma mark ---------按钮切换的的状态机--------
@protocol JCVSortDelegate <NSObject>
@optional
-(void)JCVSstart;
-(void)JCVSstop;
@end

@interface JCVSort : NSObject<JCVSortDelegate>
{
}
@property (assign, nonatomic) JokeColumnView        *owner;
@property (assign, nonatomic) UIImageView           *sortLine;
@property (assign, nonatomic) UIButton              *sortBtn;
@property (assign, nonatomic) JokeManager           *jokeManager;
@property (copy, nonatomic) NSIndexPath             *jokeIndexPath;
-(id)init:(JokeColumnView *)pOwner :(NSIndexPath *)pJokeIndexPath :(JokeManager *)pJokeManager :(UIButton *)pBtn :(UIImageView *)pLine;
@end
